<div class="g-doc_select_friends">
	<div class="picbox">
		<a href="<?php if($this->link): echo $this->link.$this->pic['Picture_ID']; else:?>http://www.newjerseysoccer.net/pd-<?php echo $this->pic['Picture_ID']?>.html<?php endif; ?>" target="_blank"><img src="<?php echo $this->pic['Picture_Url']?>" width="200" height="200" /></a>
	</div>
	<div class="spain">
		<font class="FFFFFF"><?php echo $this->pic['Picture_Title']?><br /></font>
		<?php echo $this->pic['Picture_Description']?>
	</div>
	<div class="buy_now"><a href="<?php if($this->link): echo $this->link.$this->pic['Picture_ID']; else:?>http://www.newjerseysoccer.net/pd-<?php echo $this->pic['Picture_ID']?>.html<?php endif; ?>" target="_blank"></a></div>
	<div id="sendmsg_box">
	<form action="/game-dosendmsg?picid=<?php echo $this->pic['Picture_ID']?>&session=<?echo $this->session;?>" id="dosendmsg_form" method="post">
	<input type="hidden" name="picurl" id="picurl" value="<?php echo $this->pic['Picture_Url']?>" />
	<div class="stepone">&gt;&gt; Step 1</div>
	<div class="holder">
		<div id="pane3" class="scroll-pane_fans">
		<ul>
			<?php if($this->fbmf):?>
			<?php foreach ($this->fbmf as $f):?>
			<li>
				<span class="face" title="<?php echo $f['name']; ?>">
					<img onclick="faceclick('<?php echo $f['id'] ?>');" src="<?php echo $f['picture']; ?>" width="50" height="50" />
				</span>
				<span class="name">
					<?php echo $f['name']; ?>
				</span>
				<span class="click" id="click_<?php echo $f['id'] ?>" cid="<?php echo $f['id'] ?>"></span>
			</li>
			<?php endforeach;?>
			<?php endif;?>
		</ul>
		<input type="hidden" name="postto" id="postto" value="" />
		</div>
	</div>
	<div class="steptwo">&gt;&gt; Step 2</div>
	<div class="messagebox1">
		<span class="sharebox">
			<span class="shareurl">
				<input id="shareurl" type="text" value="<?php if($this->sharelink): echo $this->sharelink.$this->pic['Picture_ID']; else:?>http://apps.facebook.com/sharejerseys/<?php endif; ?>" />
			</span>
			<span class="sharebtn" id="sharebtn"></span>
			<span class="sharebtn_desc">Copy the link and share to your friends on MSN, Skype or forums, then you can earn money when person purchases the jersey.</span><!--  -->
		</span>
		<input type="hidden" value="<?php echo $this->f ?>" name="f" id="f" />
	</div>
	<div class="messagebox2">
		<span class="textarea">
			<textarea class="innerarea" name="content" id="content">Jerseys in newjerseysoccer are pretty good. Trust me, you must like them.</textarea>
		</span>
		<span class="sendbtn" id="sendbtn"></span>
	</div>
	</form>
	</div>
</div>
<script src="http://www.zhangxinxu.com/Scripts/swfobject_modified.js?ver=20100817" type="text/javascript"></script>
<script type="text/javascript">
	$(function()
	{
		//$('#pane3').jScrollPane({arrowSize: 19});
		$(".click").each(function(){
			$(this).click(function(){
				$(".on").removeClass("on");
				$(this).addClass("on");
				$("#postto").val($(this).attr("cid"));
			});
		});
		
		$("#sendbtn").click(function(){
			var picurl = $("#picurl").val();
			var postto = $("#postto").val();
			var content = $("#content").val();
			var f = $("#f").val();
			if(postto == '') {
				alert('Please select a friend.');
				return false;
			}
			$.ajax({
				type: "POST",
				url: "/game-dosendmsg",
				data: {picurl:picurl,postto:postto,content:content,f:f,signed_request:"<?php echo $this->signed_request;?>"},
				success: function(data) {
					if(data == 'ok') {
						$("#sendmsg_box").html("<div class='holder' style=\"left:266px;\"><strong style=\"float: left;display: inline;cursor: pointer;height:28px;line-height:28px;font-size: 14px;\">NICE SEND!</strong><input type=\"button\" style=\"width:143px;height:28px;background:url('../images/game/share_again.png') no-repeat;border:0;float: left;display: inline;cursor: pointer;margin-left: 20px;\" onclick=\"window.location.href='/game-join'\" /></div>");
						return false;
					} else {
						alert(data);
						return false;
					}
				}			
			});
		});
		/*
		$("#shareurl").click(function(){
			$(this).select();
		});
		$("#sharebtn").click(function(){
			//alert("The url had copy to clipboard");
			if (window.clipboardData) {
				var val =  $("#shareurl").val();
	            if( window.clipboardData.setData("Text", val))
	            	alert("Copied.");
	            else
	            	alert("Your browser doesn't support the copy to clipboard function, please copy the link manually.");
	         } else {
	        	alert("Your browser doesn't support the copy to clipboard function, please copy the link manually.");
	         }
		});*/
	});
		
	var copyCon = document.getElementById("shareurl").value;
	var flashvars = {
	    content: encodeURIComponent(copyCon),
	    uri: '/images/game/copy.png'
	};
	var params = {
	    wmode: "transparent",
	    allowScriptAccess: "always"
	};
	swfobject.embedSWF("/images/game/clipboard.swf", "sharebtn", "56", "22", "9.0.0", null, flashvars, params);
	
	function copySuccess(){
	    alert('The share link has been copied to the clipboard.');
	}
	function faceclick(id) {
		$("#click_"+id).trigger('click');
	}
</script>